package my.spring.common;

import java.sql.Connection;
import java.sql.DriverManager;

public class DbUtils {
	private static final String ORACLE_DRIVER = "Oracle.jdbc.driver.OracleDriver";
	private static final String MYSQL_DRIVER = "com.mysql.jdbc.Driver";
	private static final String MSSQL_DRIVER ="com.microsoft.jdbc.sqlserver.SQLServerDriver";
	private static final String DB2_DRIVER = "com.ibm.db2.jdbc.app.DB2Driver";
	
	private static final String ORACLE_URL = "jdbc:oracle:thin:@localhost:1521:orcl";
	private static final String MYSQL_URL = "jdbc:mysql://localhost:3306/orcl";
	private static final String MSSQL_URL = "jdbc:microsoft:sqlserver://localhost:1433:DatabaseName=orcl";
	private static final String DB2_URL = "jdbc:db2://localhost:5000/orcl";
	
	private static final String USER = "";
	private static final String PWD = "";
	
	public static Connection getConnection() {
		Connection conn = null;
		try {
			Class.forName(ORACLE_DRIVER);
			conn = DriverManager.getConnection(ORACLE_URL, USER, PWD);
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		return conn;
	}
}
